const token = 'user-token' // 用户token
const userInfo = 'user-info' // 用户信息
const cookie = 'user-cookie' // 本地cookie
const songInfo = 'user-songInfo' // 本地存储的歌曲信息

// 设置本地token
export const setTokenStorage = (data = '') => wx.setStorage({ key: token, data })

// 设置用户信息
export const setUserInfoStorage = (data = '') => wx.setStorage({ key: userInfo, data })

// 删除本地对应的存储
export const removeStorage = () => wx.removeStorage(key)

// 获取本地token 
export const getToken = () => wx.getStorage({ key: token })

// 获取本地用户信息
export const getUserInfo = () => wx.getStorage({
  key: userInfo,
  // fail: () => Promise.reject() ,
  // success:res => res
})

// 设置本地Cookie
export const setCookie = (data = '') => wx.setStorage({key: cookie, data})

// 获取本地cookie 
export const getCookie = () => wx.getStorage({ key: cookie })

// 设置本地歌曲信息
export const setSongInfo = (data = '') => wx.setStorage({key: songInfo, data})

// 获取本地设置的歌曲信息
export const getSongInfo = () => wx.getStorage({ key: songInfo })

// 删除本地设置的歌曲信息
export const removeSongInfo = () => wx.removeStorage({key: songInfo})